Release 10.1A: OpenEdge Data Management:
SQL Reference


NEXTVAL

NEXTVAL returns a sequence’s next value. References to NEXTVAL increment the sequence value by the defined increment and return the new value.

Use the following syntax to reference the next value of a sequence:

Syntax
schema.sequence.NEXTVAL 

schema

Specifies the schema that contains the sequence. To refer to the next value of a sequence in the schema of another user, you must have SELECT object privilege on the sequence.

sequence

Specifies the name of the sequence whose next value you want.

Note: A statement referencing NEXTVAL for a noncycling sequence returns an error after reaching the maximum value.

Use NEXTVAL in the:

NEXTVAL cannot be used in:

Example

Note: Sequences are not associated with tables. This example provides reference to a table in order to conform to correct OpenEdge SQL syntax.

In the following example, the sequence generator increments the customer sequence and uses its value for a new customer inserted into the table pub.customer:

INSERT INTO pub.customer VALUES (customer_sequence.NEXTVAL,’USA’,’BackCountry Equipment’,’Sugar Hill Road’,’12A’,’Franconia’,’NH’,’03242’,’Dan Egan’,’603-762-2121’,’Kirsten Ulmner’, 10000.00, 500.00,’net 10’, 0,’contact monthly’);


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095